package everydayGrade.t6;

/**
 * @Author: Siantar
 * @Date: 2023-10-01-10:27
 * @Description: 1.0
 */
public class T0121 {
    public int maxProfit(int[] prices) {
        int min = prices[0];
        int max = 0;
        for (int p : prices) {
            if (p - min > max) {
                max = p - min;
            }
            if (p < min) {
                min = p;
            }
        }
        return max;
    }
}
